package com.maomao.maomaochong_i.fenLeiPackage.Factory;

import com.maomao.maomaochong_i.global.Show;
import com.maomao.maomaochong_i.quanxing.Adpater.BrandNewAdapter;
import com.maomao.maomaochong_i.quanxing.Adpater.InterestinProductAdapter;
import com.maomao.maomaochong_i.quanxing.Adpater.PhoneaccessoriesAdapter;
import com.maomao.maomaochong_i.quanxing.Adpater.SecondPhoneAdpter;
import com.maomao.maomaochong_i.quanxing.ShanPingShuJu;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Mrma on 17.6.14.
 */

public class FenLeiFactory{
    private static List<ArrayList<ShanPingShuJu>> list = new ArrayList<>();
    private static FenLeiFactory fenLeiFactory;


    private FenLeiFactory(){
        list.add(BrandNewAdapter.getOne().getGetlist());
        list.add(SecondPhoneAdpter.getOne().getGetlist());
        list.add(InterestinProductAdapter.getOne().getGetlist());
        list.add(PhoneaccessoriesAdapter.getOne().getGetlist());
    }


    public static List<ShanPingShuJu> getList(Show show) {
        get();
        switch (show){
            case NEWPHONE:
                return list.get(0);
            case SENCONEDPHOE:
                return list.get(1);
            case INTERESSTION:
                return list.get(2);
            case PHONEACCESSORIES:
                return list.get(3);
        }
        return null;
    }


    private static void get(){
        if (fenLeiFactory == null)
            fenLeiFactory = new FenLeiFactory();
    }
    public static List<ArrayList<ShanPingShuJu>> getList() {
        get();
        return list;
    }
}
